﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using blackhouse.Cache;

namespace blackhouse.Web.Cache
{
    public class WebCacheKey : CacheKey
    {
        #region Public Properties

        public WebStorageSouce StorageSource { get; private set; }

        #endregion

        #region Constructors

        public WebCacheKey(string key, TimeSpan timeExpiration)
            : this(key, key, DateTime.Now, timeExpiration)
        { }

        public WebCacheKey(string key, TimeSpan timeExpiration, CacheValueChanged onChange)
            : this(key, key, DateTime.Now, timeExpiration, onChange)
        { }

        public WebCacheKey(string key, TimeSpan timeExpiration, WebStorageSouce source)
            : this(key, key, DateTime.Now, timeExpiration, source)
        { }

        public WebCacheKey(string key, TimeSpan timeExpiration, CacheValueChanged onChange, WebStorageSouce source)
            : this(key, key, DateTime.Now, timeExpiration, onChange, source)
        { }

        public WebCacheKey(string key, string identifier, TimeSpan timeExpiration)
            : this(key, identifier, DateTime.Now, timeExpiration)
        { }

        public WebCacheKey(string key, string identifier, TimeSpan timeExpiration, CacheValueChanged onChange)
            : this(key, identifier, DateTime.Now, timeExpiration, onChange)
        { }

        public WebCacheKey(string key, string identifier, TimeSpan timeExpiration, WebStorageSouce source)
            : this(key, identifier, DateTime.Now, timeExpiration, source)
        { }

        public WebCacheKey(string key, string identifier, TimeSpan timeExpiration, CacheValueChanged onChange, WebStorageSouce source)
            : this(key, identifier, DateTime.Now, timeExpiration, onChange, source)
        { }

        public WebCacheKey(string key, DateTime setTime, TimeSpan timeExpiration)
            : this(key, key, setTime, timeExpiration)
        { }

        public WebCacheKey(string key, DateTime setTime, TimeSpan timeExpiration, CacheValueChanged onChange)
            : this(key, key, setTime, timeExpiration, onChange)
        { }

        public WebCacheKey(string key, DateTime setTime, TimeSpan timeExpiration, WebStorageSouce source)
            : this(key, key, setTime, timeExpiration, source)
        { }

        public WebCacheKey(string key, DateTime setTime, TimeSpan timeExpiration, CacheValueChanged onChange, WebStorageSouce source)
            : this(key, key, setTime, timeExpiration, onChange, source)
        { }

        public WebCacheKey(string key, string identifier, DateTime setTime, TimeSpan timeExpiration)
            : this(key, identifier, setTime, timeExpiration, WebStorageSouce.Memory)
        { }

        public WebCacheKey(string key, string identifier, DateTime setTime, TimeSpan timeExpiration, CacheValueChanged onChange)
            : this(key, identifier, setTime, timeExpiration, onChange, WebStorageSouce.Memory)
        { }

        public WebCacheKey(string key, string identifier, DateTime setTime, TimeSpan timeExpiration, WebStorageSouce source)
            : this(key, identifier, setTime, timeExpiration, null, source)
        { }

        public WebCacheKey(string key, string identifier, DateTime setTime, TimeSpan timeExpiration, CacheValueChanged onChange, WebStorageSouce source)
            : base(key, identifier, setTime, timeExpiration, onChange)
        {
            this.StorageSource = source;
        }

        #endregion

        #region New Methods

        public override CacheKey Copy()
        {
            return new WebCacheKey(this.Key, this.Identifier, DateTime.Now, this.TimeExpiration, this.OnChanged, this.StorageSource);
        }

        #endregion
    }

}
